unit Exp_Unit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, DB, Grids, DBGrids, ADODB;

type
  TExp_Form = class(TForm)
    GroupBox1: TGroupBox;
    DBGrid1: TDBGrid;
    DataSource1: TDataSource;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    BitBtn3: TBitBtn;
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure DataSource1StateChange(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Exp_Form: TExp_Form;

implementation
uses Srv_DataUnit;
{$R *.dfm}

procedure TExp_Form.BitBtn1Click(Sender: TObject);
begin
  AdoDataSet1.Post;

end;

procedure TExp_Form.BitBtn2Click(Sender: TObject);
begin
  AdoDataSet1.Cancel;

end;

procedure TExp_Form.BitBtn3Click(Sender: TObject);
begin
  Close;
end;

procedure TExp_Form.FormCreate(Sender: TObject);
begin
  AdoDataSet1.Close;
  AdoDataSet1.Open;

end;

procedure TExp_Form.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  AdoDataSet1.Close;
  Action := CaFree;

end;

procedure TExp_Form.DataSource1StateChange(Sender: TObject);
begin
  BitBtn1.Enabled := AdoDataSet1.State in [dsInsert,dsEdit];
  BitBtn2.Enabled := BitBtn1.Enabled;
  BitBtn3.Enabled := not BitBtn1.Enabled;
end;

end.
